﻿<script language="JavaScript" src="<?php echo TMPL_URL_CURRENT?>Calendar/calendar_us.js"></script>
	<link rel="stylesheet" href="<?php echo TMPL_URL_CURRENT?>Calendar/calendar.css">
<form action="index.php" method="post" name="addcus" >

<table>
<tr style="border:1px solid silver">
		<td colspan="2" style="background:silver;"><h4><?php echo (isset($this->item->id)?'Cập nhật thông tin khách hàng':'Thêm thông tin khách hàng') ?></h4></td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Mã số khách hàng</td>
		<td>
			<input type="text" style="width:260px;" name="code" value="<?php echo @$this->item->code ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Họ và tên</td>
		<td>
			<input type="text" style="width:260px;" name="name" value="<?php echo @$this->item->name ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Chứng minh nhân dân</td>
		<td>
			<input type="text" style="width:260px;" name="cmnd" value="<?php echo @$this->item->cmnd ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Địa chỉ</td>
		<td>
			<input type="text" style="width:260px;" name="address" value="<?php echo @$this->item->address ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Số điện thoại</td>
		<td>
			<input type="text" style="width:260px;" name="mobile" value="<?php echo @$this->item->mobile ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Email</td>
		<td>
			<input type="text" style="width:260px;" name="email" value="<?php echo @$this->item->email ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Sản phẩm mua</td>
		<td>
			<input type="text" style="width:260px;" name="productname" value="<?php echo @$this->item->productname ?>" />		
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Ngày mua</td>
		<td>
		
			<input type="text" style="width:260px;"  name="date_buy" value="<?php echo @date('m/d/Y',$this->item->date_buy) ?>" />		
			<script language="JavaScript">

	new tcal ({
		// form name
		'formname': 'addcus',
		// input name
		'controlname': 'date_buy',
	});
	</script>
		</td>
	</tr>
	<tr style="border:1px solid silver">
		<td>Ngày hết hạn bảo hành</td>
		<td>
	<input type="text" style="width:260px;" name="date_end" value="<?php echo @date('m/d/Y',$this->item->date_end) ?>" />		
	<script language="JavaScript">

	// sample of date calculations:
	// - set selected day to 3 days from now
	var d_selected = new Date();
	d_selected.setDate(d_selected.getDate() + 3);
	var s_selected = f_tcalGenerDate(d_selected);
	
	// - set today as yesterday
	var d_yesterday = new Date();
	d_yesterday.setDate(d_yesterday.getDate() - 1);
	var s_yesterday = f_tcalGenerDate(d_yesterday);

	new tcal ({
		// form name
		'formname': 'addcus',
		// input name
		'controlname': 'date_end',
		'selected' : s_selected,
		'today' : s_yesterday
	});
	
	</script>
			
		</td>
	</tr>
	<tr>
		<td>
			<input type="submit" name="Submit" value="Save" />
			<input type="button" onclick="document.location.href='index.php?c=custommer';" value="Close" />
		</td>
	</tr>
</table>
<input type="hidden" name="c" value="custommer" />
<input type="hidden" name="t" value="proccessadd" />
<input type="hidden" name="id" value="<?php echo @(int)$this->item->id ?>" />
</form>
<script >
	function checkvalid()
	{
		if(document.addFrom.name.value=='')
			alert('Vui lòng nhập tên !');
		else
			document.addFrom.submit();
	}
</script>